package com.example.design.patterns.冰河.行为模式.备忘录模式;

import com.example.design.patterns.冰河.行为模式.备忘录模式.caretaker.Caretaker;
import com.example.design.patterns.冰河.行为模式.备忘录模式.originator.Originator;

public class Test {
    public static void main(String[] args) {
        Originator originator = new Originator();
        originator.setState("开会中");

        Caretaker caretaker = new Caretaker();
        caretaker.setMemento(originator.createMemento());//将数据封装在Caretaker中

        originator.setState("睡觉中");

        originator.showState();

        originator.setMemento(caretaker.getMemento());//将数据重新导入

        originator.showState();
    }
}
